;-------------------------------------------------------------------------------------------- ; FILE: (Put name of project here) ; PCB: (Put name of schematic here) ; AUTH: (Creators name) ; DATE: (Date) ; DESC: (Give a description of the software) ;-------------------------------------------------------------------------------------------- LIST P=16F628A, R=DEC ; All numbers Decimal format unless otherwise stated. include ; Define configurations, registers, etc. __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF ; ;-------------------------------------------------------------------------------------------- ; Port Definitions. Tell the compiler what the port pins are used for. ;-------------------------------------------------------------------------------------------- ; Put port definitions here ;-------------------------------------------------------------------------------------------- ; Variables. Names created for use. Memory locations that I can write to. ;-------------------------------------------------------------------------------------------- cblock h'20' ; 1st part of General Purpose Register I can use. Variable1 ; Variable 1 Variable2 ; Variable 2 endc ;-------------------------------------------------------------------------------------------- ; Program Code ;-------------------------------------------------------------------------------------------- ORG 0 ; Start assembly here Reset vector. . ;-------------------------------------------------------------------------------------------- ; Initialisation - Set up all ports. Make unused ports outputs. ;-------------------------------------------------------------------------------------------- Init bsf STATUS,RP0 ; Set RP0 to 1 bcf STATUS,RP1 ; Set RP1 to 0 ; Bank 1 Selected clrf VRCON ; Set Vref to off clrf TRISB ; Set all PortB as Output movlw b'00001111' ; Load 00001111 to working register movwf TRISA ; Set bit, 0, 1, 2 and 3 to inputs PortA bcf STATUS,RP0 ; Set RP0 to 0 ; Bank 0 Selected movlw d'7' ; Load working register with "7" movwf CMCON ; Turn off comparators clrf PORTA clrf PORTB clrf Variable1 clrf Variable2 ; Clear variables and output ports ;-------------------------------------------------------------------------------------------- ; Main part of program ;-------------------------------------------------------------------------------------------- Start ; Main code here goto Start END ;Stop assembling here ;--------------------------------------------------------------------------------------------